/*
 * Copyright 2004-2008 the Seasar Foundation and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.yakaten.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import net.arnx.jsonic.JSON;

import org.seasar.framework.beans.util.BeanMap;
import org.seasar.struts.annotation.Execute;

public class JancdMngAction extends BaseAction {

	@Execute(validator = false)
	public String index() {
		return "../jancdMng.jsp";
	}

	@Execute(validator = false)
	public String getAllJanCode() throws IOException {

		List<BeanMap> result = new ArrayList<BeanMap>();

		BeanMap map1 = new BeanMap();
		map1.put("categoryName", "ノートパソコン");
		map1.put("janCode", "4905524718713");
		map1.put("itemName", "VPCCB39FJL　SONY VAIO Cシリーズ");
		map1.put("itemCount", "1111");
		map1.put("zaikoCount", "111");
		map1.put("zaikoKakuhoCount", "11");
		result.add(map1);

		BeanMap map2 = new BeanMap();
		map2.put("categoryName", "ノートパソコン");
		map2.put("janCode", "4905524811513");
		map2.put("itemName", "VPCF237FJS　SONY VAIO Fシリーズ");
		map2.put("itemCount", "2222");
		map2.put("zaikoCount", "222");
		map2.put("zaikoKakuhoCount", "22");
		result.add(map2);

		BeanMap map3 = new BeanMap();
		map3.put("categoryName", "プリンタ");
		map3.put("janCode", "4960999784861");
		map3.put("itemName", "MG3130　CANON キヤノン インクジェットプリンタ 複合機 PIXUS MG3130");
		map3.put("itemCount", "3333");
		map3.put("zaikoCount", "333");
		map3.put("zaikoKakuhoCount", "33");
		result.add(map3);

		BeanMap map4 = new BeanMap();
		map4.put("categoryName", "プリンタ");
		map4.put("janCode", "4969887238899");
		map4.put("itemName", "EP-903F　EPSON マルチフォトカラリオ");
		map4.put("itemCount", "4444");
		map4.put("zaikoCount", "444");
		map4.put("zaikoKakuhoCount", "44");
		result.add(map4);

		
		BeanMap map5 = new BeanMap();
		map5.put("categoryName", "ノートパソコン");
		map5.put("janCode", "4547597754895");
		map5.put("itemName", "MC916J/A　iPad 2 Wi-Fiモデル 64GB");
		map5.put("itemCount", "5555");
		map5.put("zaikoCount", "555");
		map5.put("zaikoKakuhoCount", "55");
		result.add(map5);

		BeanMap map6 = new BeanMap();
		map6.put("categoryName", "ノートパソコン");
		map6.put("janCode", "4905524718714");
		map6.put("itemName", "VPCCB39FJL　SONY VAIO Cシリーズ");
		map6.put("itemCount", "1111");
		map6.put("zaikoCount", "111");
		map6.put("zaikoKakuhoCount", "11");
		result.add(map6);

		BeanMap map7 = new BeanMap();
		map7.put("categoryName", "ノートパソコン");
		map7.put("janCode", "4905524811514");
		map7.put("itemName", "VPCF237FJS　SONY VAIO Fシリーズ");
		map7.put("itemCount", "2222");
		map7.put("zaikoCount", "222");
		map7.put("zaikoKakuhoCount", "22");
		result.add(map7);

		BeanMap map8 = new BeanMap();
		map8.put("categoryName", "プリンタ");
		map8.put("janCode", "4960999784862");
		map8.put("itemName", "MG3130　CANON キヤノン インクジェットプリンタ 複合機 PIXUS MG3130");
		map8.put("itemCount", "3333");
		map8.put("zaikoCount", "333");
		map8.put("zaikoKakuhoCount", "33");
		result.add(map8);

		BeanMap map9 = new BeanMap();
		map9.put("categoryName", "プリンタ");
		map9.put("janCode", "4969887238898");
		map9.put("itemName", "EP-903F　EPSON マルチフォトカラリオ");
		map9.put("itemCount", "4444");
		map9.put("zaikoCount", "444");
		map9.put("zaikoKakuhoCount", "44");
		result.add(map9);

		
		BeanMap map10 = new BeanMap();
		map10.put("categoryName", "ノートパソコン");
		map10.put("janCode", "4547597754895");
		map10.put("itemName", "MC916J/A　iPad 2 Wi-Fiモデル 64GB");
		map10.put("itemCount", "5555");
		map10.put("zaikoCount", "555");
		map10.put("zaikoKakuhoCount", "55");
		result.add(map10);
		
		BeanMap map11 = new BeanMap();
		map11.put("categoryName", "ノートパソコン");
		map11.put("janCode", "4905524718711");
		map11.put("itemName", "VPCCB39FJL　SONY VAIO Cシリーズ");
		map11.put("itemCount", "1111");
		map11.put("zaikoCount", "111");
		map11.put("zaikoKakuhoCount", "11");
		result.add(map11);

		BeanMap map12 = new BeanMap();
		map12.put("categoryName", "ノートパソコン");
		map12.put("janCode", "4905524811511");
		map12.put("itemName", "VPCF237FJS　SONY VAIO Fシリーズ");
		map12.put("itemCount", "2222");
		map12.put("zaikoCount", "222");
		map12.put("zaikoKakuhoCount", "22");
		result.add(map12);

		BeanMap map13 = new BeanMap();
		map13.put("categoryName", "プリンタ");
		map13.put("janCode", "4960999784862");
		map13.put("itemName", "MG3130　CANON キヤノン インクジェットプリンタ 複合機 PIXUS MG3130");
		map13.put("itemCount", "3333");
		map13.put("zaikoCount", "333");
		map13.put("zaikoKakuhoCount", "33");
		result.add(map13);

		BeanMap map14 = new BeanMap();
		map14.put("categoryName", "プリンタ");
		map14.put("janCode", "4969887238891");
		map14.put("itemName", "EP-903F　EPSON マルチフォトカラリオ");
		map14.put("itemCount", "4444");
		map14.put("zaikoCount", "444");
		map14.put("zaikoKakuhoCount", "44");
		result.add(map14);

		
		BeanMap map15 = new BeanMap();
		map15.put("categoryName", "ノートパソコン");
		map15.put("janCode", "4547597754891");
		map15.put("itemName", "MC916J/A　iPad 2 Wi-Fiモデル 64GB");
		map15.put("itemCount", "5555");
		map15.put("zaikoCount", "555");
		map15.put("zaikoKakuhoCount", "55");
		result.add(map15);

		BeanMap map16 = new BeanMap();
		map16.put("categoryName", "ノートパソコン");
		map16.put("janCode", "4905524718711");
		map16.put("itemName", "VPCCB39FJL　SONY VAIO Cシリーズ");
		map16.put("itemCount", "1111");
		map16.put("zaikoCount", "111");
		map16.put("zaikoKakuhoCount", "11");
		result.add(map16);

		BeanMap map17 = new BeanMap();
		map17.put("categoryName", "ノートパソコン");
		map17.put("janCode", "4905524811511");
		map17.put("itemName", "VPCF237FJS　SONY VAIO Fシリーズ");
		map17.put("itemCount", "2222");
		map17.put("zaikoCount", "222");
		map17.put("zaikoKakuhoCount", "22");
		result.add(map17);

		BeanMap map18 = new BeanMap();
		map18.put("categoryName", "プリンタ");
		map18.put("janCode", "4960999784861");
		map18.put("itemName", "MG3130　CANON キヤノン インクジェットプリンタ 複合機 PIXUS MG3130");
		map18.put("itemCount", "3333");
		map18.put("zaikoCount", "333");
		map18.put("zaikoKakuhoCount", "33");
		result.add(map18);

		BeanMap map19 = new BeanMap();
		map19.put("categoryName", "プリンタ");
		map19.put("janCode", "4969887238891");
		map19.put("itemName", "EP-903F　EPSON マルチフォトカラリオ");
		map19.put("itemCount", "4444");
		map19.put("zaikoCount", "444");
		map19.put("zaikoKakuhoCount", "44");
		result.add(map19);

		
		BeanMap map110 = new BeanMap();
		map110.put("categoryName", "ノートパソコン");
		map110.put("janCode", "4547597754891");
		map110.put("itemName", "MC916J/A　iPad 2 Wi-Fiモデル 64GB");
		map110.put("itemCount", "5555");
		map110.put("zaikoCount", "555");
		map110.put("zaikoKakuhoCount", "55");
		result.add(map110);	
		
		response.getWriter().write(
				"{\"totalCount\":\"" + 2 + "\",\"results\":"
						+ JSON.encode(result) + "}");
		 
		return null;
	}

	@Execute(validator = false)
	public String getJanCodeDetail() throws IOException {

		List<BeanMap> result = new ArrayList<BeanMap>();

		BeanMap map1 = new BeanMap();
		map1.put("itemCode", "VPCCB39FJL1");
		map1.put("itemStatus", "在庫");
		map1.put("nyukaDate", "2012/4/1 ");
		map1.put("syukaDate", "");
		result.add(map1);

		BeanMap map2 = new BeanMap();
		map2.put("itemCode", "VPCCB39FJL2");
		map2.put("itemStatus", "被確保");
		map2.put("nyukaDate", "2012/4/1 ");
		map2.put("syukaDate", "");
		result.add(map2);

		BeanMap map3 = new BeanMap();
		map3.put("itemCode", "VPCCB39FJL3");
		map3.put("itemStatus", "出荷済");
		map3.put("nyukaDate", "2012/4/1 ");
		map3.put("syukaDate", "2012/5/1");
		result.add(map3);

		response.getWriter().write(
				"{\"totalCount\":\"" + 3 + "\",\"results\":"
						+ JSON.encode(result) + "}");

		return null;
	}

}
